<template>
    <view>
        <!-- #ifdef MP-WEIXIN -->
        <top-nav :inner-title="title" is-show-back="true" is-fixed="true" :navH="navH" :n="n" is-white="bg-white" opacity="1"></top-nav>
        <view :style="{height:navH + 'px'}"></view>
        <!-- #endif -->
        <block v-if="isCheck">
        <view class='fujia'>
          <view class='option'>
            <view class='item'>
              <view>
                <text>单位名称</text>
              </view>
              <text>{{storeInfo.card_name}}</text>
            </view>
          </view>
          <view class='option'>
            <view class='item'>
              <view>
                <text>经营地址</text>
              </view>
              <text>{{storeInfo.address}}</text>
            </view>
          </view>
          <view class='option'>
            <view class='item'>
              <view>
                <text>法人</text>
              </view>
              <text>{{storeInfo.corporate}}</text>
            </view>
          </view>
          <view class='option'>
            <view class='item'>
              <view>
                <text>许可证号</text>
              </view>
              <text>{{storeInfo.card_no}}</text>
            </view>
          </view>
          <view class='option'>
            <view class='item'>
              <view>
                <text>有效期</text>
              </view>
              <text>{{storeInfo.endtime}}</text>
            </view>
          </view>
        </view>

        <view class='fujia'>
          <view class='option'>
            <view class='item1'>
              <view>
                <text class="a1">商家从业资质</text>
              </view>
              <text></text>
            </view>
          </view>
          <view class='option'>
            <view class="cert">
              <image :src="storeInfo.card_img" @click="goCard_img($event)" :data-src="storeInfo.card_img"></image>
              <image :src="storeInfo.eat_img" @click="goEat_img($event)" :data-src="storeInfo.eat_img"></image>
            </view>
          </view>
        </view>
        </block>
        <block v-if="isCheck==false">
            <view class='empty'>
              <text>资质正在审核中...</text>
            </view>
        </block>
    </view>
</template>

<script>
	import request from '../../../common/request.js';
	import $api_base from '../../../api/api_base.js';
	import topNav from '@/template/topnav/index.vue';
	export default {
		components: { topNav },
		data() {
			return {
				navH:0,
				n:0,
				title: '营业资质',
				storeInfo: [],
                isCheck: false
			}
		},
		onLoad: function(options){
            let pages     = getCurrentPages();
            let prevPage  = pages[pages.length - 2];
            prevPage.$vm.fromPage = 'storeSearch';
			this.navH    = getApp().globalData.navHeight; 
			this.n       = getApp().globalData.n;
            var storeId  = options.storeId || 0;
            let self     = this;
            $api_base.post($api_base.storeCertification,{store_id: storeId}).then(function(res){
                let data = res.data;
                if (data.ok == 1) {
                    self.storeId = storeId; 
                    self.storeInfo = data.store_cert;
                    self.isCheck = true;
                }
            });
		 },
		 methods:{
			goCard_img: function (event) {
                var src = event.currentTarget.dataset.src;//获取data-src
                uni.previewImage({
                    current: src, // 当前显示图片的http链接
                    urls: [src] // 需要预览的图片http链接列表
                });
            },
            goEat_img: function (event) {
                var src = event.currentTarget.dataset.src;//获取data-src
                uni.previewImage({
                    current: src, // 当前显示图片的http链接
                    urls: [src] // 需要预览的图片http链接列表
                });
            },
		 }
		
	}
</script>
<style>
    page{
        background-color: #fff;
    }
</style>
<style lang="scss" scoped>
	@import 'index.scss';
</style>
